{volist name="tasks" id="task" key="task_index"}
<li>
    <div class="task-list-wrap" style="width:100%;padding:0px;margin-top:10px;">
        <div class="lines-top"  {if $task.category_type == "nopass"} style="height:85px"{/if}>
        	<div style="float:left;width:80px;">
        		<div style="margin:10px;margin-top:5px;">
               		<img style="width:60px;height:60px;border-radius:4px;" src="{$task.avatar}">
        		</div>
        		<div style="text-align:center;height:30px;line-height:30px;">
        			<span class="view"></span>
        			{$task.click}
        		</div>
        	</div>
        	
        	<div style="float:left;width:calc(100% - 80px);">
	            <div class="task-line-top" >
	            	<div style="float:left;">
	            		
	            		<b><a href="/home/task/detail/id/{$task['id']}.html" style="padding: 0;border: 0;margin: 0;width: auto; float: left"><span class="task-title">[{$task['id']}]  {$task['title']} </span></a></b>
	            	</div>
	              
	               <div class="task-status" style="float:right;margin-right:20px;">
	                   {if $task.category_type == "past"}
	                                暂停中
	                                {/if}
	                                {if $task.category_type == "complete"}
	                                已下架
	                                {/if}
	                                {if $task.category_type == "wait"}
	                                待审核
	                                {/if}
	                                {if $task.category_type == "nopass"}
	                                未通过审核
	                                {/if}
	                                {if $task.category_type == "ing"}
	                                进行中
	                                {/if}
	               </div>
	            </div>
	            <div class="line-task-down"style="line-height:20px;margin-top:5px;">
	            	<div>
		                单价： {$task['unit_price']}元
	            	</div>

		          <div>
	            	
	                <div style="float:left;">
	                	预订：{$task['join_num']} ，  剩余：{$task['ticket_num']-$task['join_num']|abs}份
	                </div>
	                
	                	<!--<div style="float:right;">-->
		                	
		                <!--	             {if $task.category_type == "ing"}-->
						            <!--  <a href="javascript:"  onclick="preShare({$task['id']},{$task['unit_price']})" class="task-list-manage-button" style="padding:0;margin-right:10px;">分享</a>-->
						            <!-- {/if}-->
		                <!--</div>-->
		                
		                	
		                </div>
	            </div>
	     
	            <div class="line-task-down" style="line-height:20px;">
	            	<div style="width:100%;height:20px;">
		                <div style="float:left;">
		                	
		                开始时间：{$task['start_time']|date='Y-m-d H:i',###}
		                </div>
		                
	            		
	            	</div>
	            	
	            	<div  style="width:100%;height:20px;">
	            		<div style="float:left;">
		                	结束时间：{$task['end_time']}
		               </div>
		               
		                <div style="float:right;">
		     {if $task.category_type == "ing" && $task.join_num != 0 }
        			 <a href="/home/mytaskaudit/index/id/{$task['id']}.html" onclick="check({$task['id']})" class="task-list-manage-button" style="padding:0;margin-right:10px;">已完成列表</a>
            {/if}
            
            </div>
            
		                
		                
	            	</div>
	            </div>
	<!--            <i class="icon"></i>-->
	            {if $task.category_type == "nopass"}
	                <div class="line-task-down">
	                    未通过审核,原因：{$task['audit_remarks']}
	                </div>
	            {/if}
            
            </div>
            <div style="clear:both;"></div>
        </div>
        <div class="task-list-manage" style="margin:10px;width:100%;">
        	{if $task['out_stock_flag']!=1}
        		{if $task['is_send_redpackage']}
        		 <a href="/home/task/redpackage/task_id/{$task['id']}"  class="task-list-manage-button add_redpackets" >红包</a>
        		 
        		 
        		{else /}
            <a href="javascript:;"  class="task-list-manage-button add_redpackets" onclick="toggle_popup({$task['id']})">红包</a>
            {/if}
{if $task['category_type'] == 'ing' || $task['category_type'] == 'past'}

{if $task['is_send_seepackage']}
<a href="javascript:;"  class="task-list-manage-button add_redpackets" onclick="toggle_add_see({$task['id']},{$task['seepackage_price']})">浏览</a>        		 	

{else /}
<a href="javascript:;"  class="task-list-manage-button add_redpackets" onclick="toggle_see({$task['id']})">浏览</a>

{/if}

{/if}
            {/if}

            {if $task.category_type == "ing"}
            <a href="javascript:" id="setTop{$task['id']}" onclick="setTop({$task['id']},'setTop')" class="task-list-manage-button">{$task['top_end_time']>0?'置顶':'置顶'}</a>
            <a href="javascript:" id="isStop{$task['id']}" onclick="isStop({$task['id']})" class="task-list-manage-button{$task['is_stop']>0?' ajax-ok':''}">{$task['is_stop']==1?'开启':'暂停'}</a>
            <a href="javascript:" id="isZhuijia{$task['id']}" onclick="setTop({$task['id']},'piaoshu')" class="task-list-manage-button">加票</a>
            <a href="javascript:" id="isJiashi{$task['id']}" onclick="setTop({$task['id']},'tianshu')" class="task-list-manage-button">加时</a>
             <a href="javascript:" id="outStockTask{$task['id']}" onclick="outStockTask({$task['id']})" class="task-list-manage-button{$task['out_stock_flag']==1?' ajax-ok':''}">{$task['out_stock_flag']==1?'已结束':'结束任务'}</a>
            
            
            {/if}
            {if $task.category_type == "wait" || $task.category_type == "nopass"}
            <!-- <a href="/home/task/edit/id/{$task['id']}.html" class="task-list-manage-button">编辑</a>-->
            <a href="javascript:" class="task-list-manage-button task-list-manage-del" id="delMyTask{$task['id']}" onclick="delMyTask({$task['id']})">退还</a>
            {/if}
            {if $task.category_type == "past"}
            <a href="/home/mytaskaudit/index/id/{$task['id']}.html" onclick="check({$task['id']})" class="task-list-manage-button">审核</a>
            <a href="javascript:" id="outStockTask{$task['id']}" onclick="outStockTask({$task['id']})" class="task-list-manage-button{$task['out_stock_flag']==1?' ajax-ok':''}">{$task['out_stock_flag']==1?'已下架':'下架'}</a>
            <a href="javascript:" id="isStop{$task['id']}" onclick="isStop({$task['id']})" class="task-list-manage-button{$task['is_stop']>0?' ajax-ok':''}">{$task['is_stop']==1?'开启':'暂停'}</a>
            <a href="javascript:" id="isZhuijia{$task['id']}" onclick="setTop({$task['id']},'piaoshu')" class="task-list-manage-button">加票</a>
            <a href="javascript:" id="isJiashi{$task['id']}" onclick="setTop({$task['id']},'tianshu')" class="task-list-manage-button">加时</a>
            <a href="javascript:" id="isJiajia{$task['id']}" onclick="setTop({$task['id']},'jiajia')" class="task-list-manage-button" >加价</a>
            {if $task.is_dj ==0}
            <a href="javascript:" style="background:#EC4F4F;" class="task-list-manage-button"  >已冻结</a><br/><br/>
            <p>冻结原因：{$task.dj_reason}</p>
            {/if}
            
            {/if}
            {if $task.category_type == "complete"}
            <a href="/home/mytaskaudit/index/id/{$task['id']}.html" onclick="check({$task['id']})" class="task-list-manage-button">审核</a>
            {/if}

        </div>
    </div>
</li>
{/volist}

<style>
    .formdisplay{
        position: absolute;
        background-color: red;
        top:100px;
        left: 0;
        width:100%;
        height: 100px;
        display: none;
    }
    .formdisplayjiashi{
        position: absolute;
        background-color: red;
        top:100px;
        left: 0;
        width:100%;
        height: 100px;
        display: none;
    }
    .lines-top{
        width: 100%;
   
    }
    .task-line-top{
        width: 100%;
        height: auto;
        margin-top: 5px;
    }
    span.task-status{
        float: left;
        color: #f96a22;
        font-size: 18px;
    }
    span.task-title{
        float: left;
        color: #294455;
        font-size: 15px;
    }
  span.task-title i{
  	font-size:14px;
  }
    i.icon{
        margin-left: 5px;
        right: 15px;
        content: '';
        background-image: url("/static/home/mobile/picture/ard.png");
        height: 25px;
        width: 14px;
        display: inline-block;
        position: absolute;
    }
    .line-task-down{
        width: 100%;
        height: auto;
        font-size: 1.2rem;
        color: #78797d;
        display: inline-block;
        clear: both;
    }
  .task-list-manage .task-list-manage-button{
  	
    
  }
</style>
<div class="formdisplay">
    <form method="post">
        <div><span>追加票数为:</span><input type="text" name="piaoshu" /></div>
        <input type="hidden" name="taskid">
        <div><input type="submit" onclick="zhuijia()"></div>
    </form>
</div>
<div class="formdisplayjiashi">
    <form method="post">
        <div><span>追加天数为:</span><input type="text" name="tianshu" /></div>
        <input type="hidden" name="taskidts">
        <div><input type="submit" onclick="jiashi()"></div>
    </form>
</div>



<div id="menu" style="position:fixed;top:0;bottom:0;height:100%;width:100%;background:rgba(0,0,0,0.5);z-index:9999;display:none;" onclick="$('#menu').hide()">

<div style="width:96%;margin-left:2%;background:#fff;border-radius:6px;position:fixed;bottom:10px;">
	<div style="width:100%;text-align:center;color:#5757ab;font-size: 16px;height:50px;line-height:50px;border-bottom:1px solid #eee;color:#FCC827;" >
	分享任务，提升排名
  </div>
  
  <div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="share(0)">
  微信朋友圈
  </div>
  <div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="share(1)">
  微信好友
  </div>
  <!--<div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="share(2)">-->
  <!--QQ好友-->
  <!--</div>-->
  <!--<div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="share(3)">-->
  <!--QQ空间-->
  <!--</div>-->
    <div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="share(4)">
  复制链接
  </div>
  <div style="width:100%;text-align:center;color:#5757ab;font-size: 18px;height:50px;line-height:50px;border-bottom:1px solid #eee;" onclick="$('#menu').hide()">
  取消
  </div>

</div>


</div>



 <script src="/static/home/mobile/js/jsbridge-mini.js"></script>


<script>
	var task_id='';
	var unit_price=''
	function preShare(id,price){
		task_id=id
		unit_price=price
		$('#menu').show();
	}
	
	function share(val){
    	if(val == 4){
    		jsBridge.setClipboardText("http://fx.99dybk.com/?task_id="+task_id);
    		alert('复制推广链接成功');
    		return;
    	}


   		jsBridge.share({
		    //分享到，0 微信朋友圈，1 微信好友，2 QQ好友，3 QQ空间；未指定则弹出分享菜单
		    to    : val,
		    //标题，未指定则为当前页面 title 标题
		    title : unit_price+"元悬赏任务，赏金立即可提现！-寻小葱",
		    //链接，未指定则为当前页面链接
		    link  : "http://zz.99dybk.com/?task_id="+task_id,
		    //图标，未指定则为 App 图标
		    imgUrl: "https://wap.99dybk.com/static/home/mobile/login/img3.jpg",
		    //描述，如未指定，App 会尝试抓取页面 meta description content，<meta name="description" content="页面描述..." />
		    //均无描述内容则显示链接
		    desc: "下载蚂蚁推客APP,搜索任务ID："+task_id+",完成任务即可提现！" 
		}, function(succ) {
			                $.post(
                            '/home/mytask/share',
                            {
                              task_id: task_id,
                            },
                            function (ret) {
                            	
                              alert(succ ? "分享成功" : "分享失败或取消了分享");
                            },'json'
                        );
                        
                        
		   
		});
    }
	
	
    function isZhuijia(id) {
        $("input[name=taskid]").val(id);
        $(".formdisplay").css('display','block');
    }
    function isJiashi(id) {
        $("input[name=taskidts]").val(id);
        $(".formdisplayjiashi").css('display','block');
    }
    function isJiajia(id) {
        $("input[name=taskidjiajia]").val(id);
        $(".formdisplayjiajia").css('display','block');
    }
</script>
<script>
    function zhuijia() {
        var piaoshu = $("input[name=piaoshu]").val();
        var id = $("input[name=taskid]").val();
        if(isNaN(piaoshu) && piaoshu==0){
            alert('请输入正确票数');
            return false;
        }
        $.post('/home/mytask/iszhuijia.html', { piaoshu:piaoshu ,taskid:id}, function(res) {
            if (res.type == "success") {
                alert(res.message)
                window.location.href = location .href;
            }
        });
    }
    function jiashi() {
        var piaoshu = $("input[name=tianshu]").val();
        var id = $("input[name=taskidts]").val();
        if(isNaN(piaoshu) && piaoshu==0){
            alert('请输入正确天数');
            return false;
        }
        $.post('/home/mytask/jiashi.html', { tianshu:piaoshu ,taskid:id}, function(res) {
            console.log(res);
            if (res.type == "success") {
                alert(res.message)
                //window.location.href = location .href;
            }
        });
    }
 
</script>

<style>
    .piaoshu{
        width: 200px;
        border: 1px solid lightgrey;
    }
</style>
<!--<script>
    function isZhuijia(id) {
        $(document).dialog({
            titleText: '追加任务ID为'+id+'的票数',
            content: "票数:<input type='text' name='piaoshu' class='piaoshu'/>",
        });
    }
</script>-->

<script>
    function isStop(id) {
        if ($("#isStop" + id).hasClass("ajax-ok")) {
            $(document).dialog({
                type : 'confirm',
                titleText: '开启任务',
                content: '确定要开启任务ID为：' + id + '任务吗？',
                onClickConfirmBtn: function(){
                    Common.loading.show();
                    $.post('/home/mytask/stopstock.html', { id: id ,status: 1}, function(res) {
                        Common.loading.hide();
                        if (res.type == "success") {
                            window.location.href = location.href;
                        }
                        message(res.message,res.redirect,res.type);
                    });
                }
            });
        }else{
            $(document).dialog({
                type : 'confirm',
                titleText: '暂停任务',
                content: '确定要暂停任务ID为：' + id + '任务吗？',
                onClickConfirmBtn: function(){
                    Common.loading.show();
                    $.post('/home/mytask/stopstock.html', { id: id }, function(res) {
                        Common.loading.hide();
                        if (res.type == "success") {
                            window.location.href = location.href;
                        }
                        message(res.message,res.redirect,res.type);
                    });
                }
            });
        }
    }
</script>